package com.peanut.boot.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.multipart.MultipartFile;

/**
 * @className: com.peanut.boot.controller-> FileCotroller
 * @description: 这个类是做做什么得吖，小朋友？
 * @author: chenhs
 * @createDate: 2021-11-15 22:49
 * @version: 1.0
 */
@Slf4j
@Controller
public class FileCotroller {
    //单文件上传
    @PostMapping(value = "/uploadFileSingle")
    public String uploadFileSingle(@RequestPart("single") MultipartFile single
    ) {
        log.info("文件信息：文件名={}，文件地址={}",single.getName(),single.getResource());
        return "success";
    }

    //多文件上传
    @RequestMapping(value = "/uploadFileArray")
    public String uploadFileArray(@RequestPart("files") MultipartFile[] file) {
        log.info("获取到个{}文件",file.length);
        return "success";
    }

}
